package com.moon.back.exception;

import lombok.Data;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 *
 */
@Getter
public enum StatusCodeEnum {

    SUCCESS("200", "Success"),
    BAD_REQUEST("400", "Bad request"),
    NO_ACCESS("401", "No access"),
    ACCESS_DENIED("403", "Access denied"),
    NOT_FOUND("404", "Not Found"),
    METHOD_NOT_ALLOWED("405", "Method not allowed"),
    UNSUPPORTED_MEDIA_TYPE("415", "Unsupported Media Type"),
    INTERNAL_ERROR("500", "Internal error"),
    SERVICE_UNAVAILABLE("503", "Service Unavailable");

    private final String code;
    private final String message;
    private static final Map<String, StatusCodeEnum> INNER = new HashMap();

    private StatusCodeEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public static StatusCodeEnum parseFromCode(String code) {
        return (StatusCodeEnum)INNER.get(code);
    }

    static {
        StatusCodeEnum[] var0 = values();
        int var1 = var0.length;

        for(int var2 = 0; var2 < var1; ++var2) {
            StatusCodeEnum c = var0[var2];
            INNER.put(c.code, c);
        }

    }
}